//上传图片回调

(function ($){
    uploadBack = function(file) {
        /*图片类型正则验证*/
        if (!file) {
            layer.tips('请上传图片', '.blog-btn-file', { tips: 3 });
            return false;
        }
        var imgStr = /\.(jpg|jpeg|png|bmp|BMP|JPG|PNG|JPEG)$/;
        if (!imgStr.test(file.name)) {
            layer.tips('请上传图片类型', '.blog-btn-file', { tips: 3 });
            return false;
        }
        var path = getObjectURL(file);
        return path;
    }
    //获取图片url路径
    getObjectURL = function(file) {
        var url = null;
        if (window.createObjectURL != undefined) {
            // basic
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) {
            // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) {
            // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }

})();
